<?php

namespace app\index\model;
use think\Model;
class PhotoLogModel extends Model
{
    protected $name = 'car_photo_log';
    protected $autoWriteTimestamp = true;
    protected $dateFormat = 'Y/m/d H:i:s';
    // 定义时间戳字段名
    protected $createTime = 'create_at';
    protected $updateTime = 'update_at';

    public function info() {
        return $this->hasOne(PhotoList::class, 'id', 'photo_id')->field(['id', 'name', 'cover', 'book_type']);
    }
    public function infos()
    {
        return $this->hasOne(PhotoList::class, 'id', 'photo_id')->with(['author'])->withCount(['buy', 'coll', 'like']);
    }

    public function menu() {
        return $this->hasOne(PohtoMenuModel::class, 'id', 'menu_id');
    }
}